package com.group.finance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.group.finance.entity.Deal;
import com.group.finance.entity.Settlement;
import com.group.finance.dao.SettlementMapper;
import com.group.finance.service.ISettlementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zgc
 * @since 2022-06-07
 */
@Service
public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlement> implements ISettlementService {

    @Resource
    private SettlementMapper settlementMapper;

    @Override
    public List<Settlement> findAll(int current, int size) {

        QueryWrapper<Settlement> wrapper = new QueryWrapper();

        Page<Settlement> page = new Page<>(current,size);

        IPage<Settlement> settlementIPage = settlementMapper.selectPage(page, wrapper);

        System.out.println("总页数"+settlementIPage.getPages());
        System.out.println("总记录数"+settlementIPage.getTotal());

        List<Settlement> settlementList = settlementIPage.getRecords();

        return settlementList;
    }
}
